package com.csx.base.design.behavior.state;

/**
 * @author cuisongxu
 * @date 2022/10/8 12:02
 */
public class Red implements State{

    @Override
    public void switchToGreen(TrafficLight trafficLight) {
        System.out.println("ERROR! 红灯不能切换为绿灯");
    }

    @Override
    public void switchToRed(TrafficLight trafficLight) {
        System.out.println("ERROR! 已经是红灯状态无需切换");
    }

    @Override
    public void switchToYellow(TrafficLight trafficLight) {
        trafficLight.setState(new Yellow());
        System.out.println("OK! 黄灯亮起5s");
    }
}
